package com.ninetaildemonfox.zdl.socialproject.utils.dialog;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.ninetaildemonfox.zdl.socialproject.base.BaseActivity;
import com.ninetaildemonfox.zdl.socialproject.R;
import com.ninetaildemonfox.zdl.socialproject.utils.ToastUtil;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author NineTailDemonFox
 * @date 2019/7/24 16:34
 * 功能描述： 设置查看金额
 * 联系方式：1037438704@qq.com
 */

public class DialogPayActivity extends BaseActivity {

    @BindView(R.id.text_determine)
    TextView textDetermine;
    @BindView(R.id.image_bottom_finish)
    ImageView imageBottomFinish;
    @BindView(R.id.edit_money)
    EditText editMoney;

    @Override
    protected int getLayoutResource() {
        return R.layout.activity_dialog_pay;
    }

    @Override
    protected void onInitialization(Bundle bundle) {


    }

    @OnClick({R.id.image_bottom_finish, R.id.text_determine})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.image_bottom_finish:
                finish();
                break;
            case R.id.text_determine:
//                if (TextUtils.isEmpty(editMoney.getText().toString().trim())) {
//                    ToastUtil.show("请输入查看金额");
//                    return;
//                }
//                if (editMoney.getText().toString().equals("0")) {
//                    ToastUtil.show("金额不能为0");
//                    return;
//                }
                if (TextUtils.isEmpty(editMoney.getText().toString().trim())) {
                    ToastUtil.show("设置金额不能为空！");
                    return;
                }
                if (editMoney.getText().toString().trim().equals("0")) {
                    ToastUtil.show("设置金额不能为0！");
                    return;
                }
                Bundle bundle = new Bundle();
                Intent i = new Intent();
                bundle.putString("money", editMoney.getText().toString().trim());
                i.putExtras(bundle);
                setResult(RESULT_OK, i);
                finish();
                break;
            default:
        }
    }

}
